import request from '@/common/request.js'
import { formatGetUri } from '@/common/util.js'

const api = {};
const HOME = 'home';
const GOODS = 'goods';
const SELFCENTER = 'self_center';
// 个人中心首页结构
api.homeselfcenter = params => request.globalRequest(`${HOME}/self_center`, 'POST', params, 1)
//今日值得买
api.home_today = params => request.globalRequest(`${GOODS}/home_today`, 'POST', params, 1)
//获取个人中心数据
api.get_userinfo = params => request.globalRequest(`${SELFCENTER}/get_userinfo`, 'POST', params, 1)
//获取个人中心邀请海报
api.invite_share = params => request.globalRequest(`${SELFCENTER}/invite_share`, 'POST', params, 1)
//淘宝授权
api.taobao_auth = params => request.globalRequest(`${SELFCENTER}/taobao_auth`, 'POST', params, 1)
//获取个人信息
api.get_user= params => request.globalRequest(`${SELFCENTER}/get_user`, 'POST', params, 1)
//获取七牛上传的token
api.getqiniutoken= params => request.globalRequest(`${SELFCENTER}/getqiniutoken`, 'POST', params, 1)
//设置头像
api.set_avatar= params => request.globalRequest(`${SELFCENTER}/set_avatar`, 'POST', params, 1)
//设置昵称
api.update_basic_info= params => request.globalRequest(`${SELFCENTER}/update_basic_info`, 'POST', params, 1)
//绑定微信
api.bind_weixin= params => request.globalRequest(`${SELFCENTER}/bind_weixin`, 'POST', params, 1)
//绑定微信
api.userinfo= params => request.globalRequest(`${SELFCENTER}/userinfo`, 'POST', params, 1)
//绑定支付宝
api.bind_alipay= params => request.globalRequest(`${SELFCENTER}/bind_alipay`, 'POST', params, 1)
//版本更新
api.get_version= params => request.globalRequest(`${SELFCENTER}/version`, 'POST', params, 1)
//特权邀请码
api.exclusive_code= params => request.globalRequest(`${SELFCENTER}/exclusive_code`, 'POST', params, 1)
//设置隐私订单
api.set_privacy_switch= params => request.globalRequest(`${SELFCENTER}/set_privacy_switch`, 'POST', params, 1)
//get特权邀请码
api.get_exclusive_code = params => request.globalRequest(`${SELFCENTER}/exclusive_code${formatGetUri(params)}`, 'GET',{}, 1)
//设置密码
api.set_password= params => request.globalRequest(`${SELFCENTER}/set_password`, 'POST', params, 1)
//设置密码
api.update_phone= params => request.globalRequest(`${SELFCENTER}/update_phone`, 'POST', params, 1)
// GET请求方式
//api.homeindex = params => request.globalRequest(`${PORT1}/index${formatGetUri(params)}`, 'GET',{}, 1)
export default api